package com.hcg.mybatis.service.impl;

import com.hcg.mybatis.domain.User;
import com.hcg.mybatis.mapper.UserMapper;
import com.hcg.mybatis.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service("userService")
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;
    @Override
    @Transactional
    public void saveUser(User user) {
        userMapper.insert(user);
    }

    @Override
    public User findById(Long uid) {
//        return userMapper.findById(uid);
        return userMapper.selectByPrimaryKey(uid);
    }
}
